package com.arcsoft.commonbase.net

/**
 */
data class BaseResponseBean<T>(val success: Boolean, val msgCode: String, val i18nMessage: String, private val datas: T? = null) {

    //返回泛型实体类
    fun apiData(): T? {
        if (success) {
            return datas
        } else {
            throw ApiException(msgCode,i18nMessage)
        }
    }

    //返回整个实体类
    fun apiDataAll(): BaseResponseBean<T> {
        if (success) {
            return this
        } else {
            throw ApiException(msgCode,i18nMessage)
        }
    }
}
